#include "StdAfx.h"
#include "Patch.h"
#include "MFHook.h"
#include "WMPHook.h"

#pragma unmanaged

void* SelectMFMethod(int num) {
	void* proc = mfHook[num];
	if (!proc) {
		proc = mfSave[num];
	}
	return proc;
}

HRESULT WINAPI MFCreateMediaSessionHook(IMFAttributes* pConfiguration, IMFMediaSession** ppMediaSession) {
	SyncFuncHook(HRESULT, PMFCreateMediaSession, SelectMFMethod(0), (pConfiguration, ppMediaSession));
}

HRESULT WINAPI MFCreatePMPMediaSessionHook(DWORD dwCreationFlags, IMFAttributes *pConfiguration, IMFMediaSession** ppMediaSession, IMFActivate **ppEnablerActivate) {
	SyncFuncHook(HRESULT, PMFCreatePMPMediaSession, SelectMFMethod(1), (dwCreationFlags, pConfiguration, ppMediaSession, ppEnablerActivate));
}

